package com.foton.ai.service.impl;

import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.image.ImageClient;
import org.springframework.ai.image.ImagePrompt;
import org.springframework.ai.image.ImageResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 图文模式 - 根据文本描述返回图片
 */
@Service
@Slf4j
public class TongYiImageServiceImpl extends AbstractTongYiServiceImpl{


    private final ImageClient imageClient;
    @Autowired
    public TongYiImageServiceImpl(ImageClient imageClient) {
        this.imageClient = imageClient;
    }

    @Override
    public ImageResponse genImg(String imgPrompt) {
        var prompt = new ImagePrompt(imgPrompt);
        return imageClient.call(prompt);
    }
}
